//
//  FirstViewController.m
//  WorkingResult
//
//  Created by 河野 智遵 on 11/08/14.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "PerformanceRootViewController.h"

@implementation PerformanceRootViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    performanceView_ = [[PerformanceRegisterViewController alloc] init];
    performanceView_.dateSelectActionTarget = self;
    performanceView_.dateSelectAction = @selector(on_performanceView_dateSelect);
    
    rootController_ = [[UINavigationController alloc] initWithRootViewController:performanceView_];
    
    dateSelect_ = [[DateSelectViewController alloc] init];
    dateSelect_.dateSelectActionTarget = self;
    dateSelect_.dateSelectAction = @selector(on_dateSelect_dateSelect);
    
    dateSelectNavi_ = [[UINavigationController alloc] initWithRootViewController:dateSelect_];
    
    [self.view addSubview:rootController_.view];
}

- (void)on_dateSelect_dateSelect
{
    performanceView_.currentDate = dateSelect_.selectedDate;
}

- (void)on_performanceView_dateSelect
{
    dateSelect_.selectedDate = performanceView_.currentDate;
    [self presentModalViewController:dateSelectNavi_ animated:YES];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}


- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc. that aren't in use.
}


- (void)viewDidUnload
{
    [super viewDidUnload];

    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc
{
    [super dealloc];
}

@end
